const userName = [{
	required: true,
	message: '用户名不能为空',
	trigger: 'blur'
}, {
	min: 5,
	max: 12,
	message: '用户名长度在 5 到 12 个字符',
	trigger: 'blur'
}]

const trueName = [{
	required: true,
	message: '真实姓名不能为空',
	trigger: 'blur'
}]

const sex = [{
	required: true,
	message: '性别不能为空',
	trigger: 'blur'
}]

const userType = [{
	required: true,
	message: '用户类型不能为空',
	trigger: 'blur'
}]

const selectedData = [{
	required: true,
	message: '所属机构不能为空',
	trigger: 'blur'
}]

const countType = [{
	required: true,
	message: '账号状态不能为空',
	trigger: 'blur'
}]

const roleType = [{
	required: true,
	message: '角色类型不能为空',
	trigger: 'blur'
}]

const jurisdiction = [{
	required: true,
	message: '权限类型不能为空',
	trigger: 'blur'
}]

const phone = [{
	required: true,
	message: '手机号码不能为空',
	trigger: 'blur'
}]

const userCompany = [{
	required: true,
	message: '使用单位不能为空',
	trigger: 'blur'
}]

const branchValue = [{
	required: true,
	message: '所属机构不能为空',
	trigger: 'blur'
}]


const personStatus = [{
		required: true,
		message: '人员状态不能为空',
		trigger: 'blur'
	},

]

//身份证
const identity = (rule, value, callback) => {
	if (!value) {
		return callback(new Error('身份证号码不能为空'));
	} else {
		const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
		console.log(reg.test(value));
		if (reg.test(value)) {
			callback();
		} else {
			return callback(new Error('请输入正确的身份证号码'));
		}
	}
};

const homeAddress = [{
		required: true,
		message: '家庭住址不能为空',
		trigger: 'blur'
	}
]

const pactStartTime = [{
	required: true,
	message: '合同开始时间不能为空',
	trigger: 'blur'
}, ]

const pactEndTime = [{
	required: true,
	message: '合同结束时间不能为空',
	trigger: 'blur'
}, ]

const mainCompany = [{
	required: true,
	message: '维保单位不能为空',
	trigger: 'blur'
}, ]

const jgCompany = [{
	required: true,
	message: '监管单位不能为空',
	trigger: 'blur'
}, ]

const phoneNum = (rule, value, callback) => {
	if (!value) {
		return callback(new Error('手机号码不能为空'));
	} else {
		const reg =
			/^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/
		if (reg.test(value)) {
			callback();
		} else {
			return callback(new Error('请输入正确的手机号码'));
		}
	}
};


export {
	userName,
	trueName,
	sex,
	userType,
	countType,
	selectedData,
	mainCompany,
	phone,
	jurisdiction,
	roleType,
	userCompany,
	branchValue,
	personStatus,
	identity,
	homeAddress,
	pactStartTime,
	pactEndTime,
}
